<?php
$model = new ClassStructures;
$class_course_id = ($type == 'course') ? 'courses_id' : 'classes_id';
$classcoursebatchid = ($type == 'course') ? 'course_batche_id' : 'class_batch_id';
$structure = $model->findAllByAttributes(array($class_course_id => $classId, $classcoursebatchid => $batchId));
$structIndex = '';
?>

<div class="formElements">
    <div class="col-2 borB addmarginB20">
        <div class="padding20px">

            <div id="venue_<?php echo $venueIndex; ?>_batch_<?php echo $batchIndex; ?>_classStructures">
                <?php if (count($structure) > 0) { ?>
                    <?php for ($structIndex = 0; $structIndex < count($structure); $structIndex++) { ?>     
                <div id="remove_class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $structIndex; ?>" class="classStructureControl">        
                <div class="common">
                            <div class="colstructure col2">
                                <div class="timef flatui">
                                    <?php echo $form->labelEx($model, 'start_time'); ?>
                                    <div class="clear"></div>
                                    <div class="input-append">
                                        <input  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][start_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_start_time_<?php echo $structIndex; ?>" type="text" class="field small"  placeholder="0"  maxlength="3" value="<?php echo $structure[$structIndex]->start_time; ?>" readonly="readonly"><span class="add-on">Min</span>
                                    </div>
                                </div>
                            </div>
                            <div class="colstructure col2">
                                <div class="timef flatui">
                                    <?php echo $form->labelEx($model, 'end_time'); ?>
                                    <div class="clear"></div>
                                    <div class="input-append">
                                        <input type="hidden" name="addclassStructure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_count_<?php echo $structIndex; ?>" value="<?php echo $structIndex; ?>" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_startDatecount">
                                        <input onkeypress="return isNumberKey(event)"  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][end_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_end_time_<?php echo $structIndex; ?>" type="text" class="field small"  maxlength="2" onblur="addValueInclassStructureStartTime(this.id)" value="<?php echo $structure[$structIndex]->end_time; ?>"><span class="add-on">Min</span>
                                    </div>
                                </div>
                            </div> 
                            <div class="clear"></div>
                        </div>

                        <div class="common">
                            <?php echo $form->labelEx($model, 'description'); ?>
                            <div class="clear"></div>
                            <textarea  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][description][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_description_<?php echo $structIndex; ?>"><?php echo $structure[$structIndex]->description; ?></textarea>
                            <div class="clear"></div>
                        </div>
                        <div class="height1px borB addmarginB30 rempaddingB"></div>
                        <?php if ($structIndex > 0) { ?>
                            <div class="common">
                                <p class="alignR remmarginB">
                                    <a href="javascript:void(0)" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $batchIndex; ?>" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_remove_count_<?php echo $structIndex; ?>" onclick="removeclassStructures(this.id);">-Remove</a></p>
                            </div>
                            <?php
                        }?></div>
                    <?php }
                } else {
                    ?>
                    <div class="common">
                        <div class="colstructure col2">
                            <div class="timef flatui">
                                <?php echo $form->labelEx($model, 'start_time'); ?>
                                <div class="clear"></div>
                                <div class="input-append">
                                    <input  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][start_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_start_time_0" type="text" class="field small"  placeholder="0"  maxlength="3" value="0" readonly="readonly"><span class="add-on">Min</span>
                                </div>
                            </div>
                        </div>
                        <div class="colstructure col2">
                            <div class="timef flatui">
                                <?php echo $form->labelEx($model, 'end_time'); ?>
                                <div class="clear"></div>
                                <div class="input-append">
                                    <input type="hidden" name="addclassStructure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_count_0" value="0" class="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_startDatecount">
                                    <input onkeypress="return isNumberKey(event)" name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][end_time][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_end_time_0" type="text" class="field small"  maxlength="2" onblur="addValueInclassStructureStartTime(this.id)"><span class="add-on">Min</span>
                                </div>
                            </div>
                        </div> 
                        <div class="clear"></div>
                    </div>

                    <div class="common">
                        <?php echo $form->labelEx($model, 'description'); ?>
                        <div class="clear"></div>
                        <textarea  name="ClassStructures[ClassVenue][<?php echo $venueIndex; ?>][ClassBatch][<?php echo $batchIndex; ?>][description][]" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_struct_description_0"> </textarea>
                        <div class="clear"></div>
                    </div>
                <?php }
                ?>

            </div> 
            <div class="clear"></div>
            <div class="common">
                <p class="alignR remmarginB">
                    <a href="javascript:void(0)" class="btn-green class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_add_structure" id="class_venue_<?php echo $venueIndex; ?>_classbatch_<?php echo $batchIndex; ?>_struct_add_count_<?php echo ($structIndex == '') ? '0' : $structIndex - 1; ?>" onclick="addclassStructures(this.id);">Add Structures</a></p>
            </div>

        </div>
    </div>        
</div>

